﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SmartProject.Entity;

using FluentNHibernate.Mapping;

namespace SmartProject.Mapping
{
    public class SprintMap : ClassMap<Sprint>
    {
        public SprintMap()
        {
            Table("SmartProject_Sprint");
            Id(x => x.Id).Column("SprintId");
            Map(x => x.Description).Length(200);
            Map(x => x.Ended)
                .Nullable();
            Map(x => x.EstimatedDays);
            References<User>(x => x.Owner)
                .Column("OwnerId")
                .Not.Nullable()
                .Fetch.Join();
            Map(x => x.Scheduled);
            Map(x => x.Started)
                .Nullable();
            HasMany<Task>(x => x.Tasks)
                .KeyColumn("SprintId");
            Map(x => x.Active).Not.Nullable();
            Map(x => x.Created).Not.Nullable();
        }
    }
}
